$(document).ready(function(){

  $('#form').validate({

    rules:{
      'uname':{
        'required':true,
        'minlength':6
      },
      'url':{
        'required':true,
        'url':true,
      },
      'email':{
        'required':true,
        'email':true,
        'remote':'ajax/checkemail.php'
      },
      'password':{
        'required':true,
        'minlength':8
      },
      'c_password':{
        'required':true,
        'equalTo':'#passwordId'
      },
      'gender':{
        'required':true
      },
      'dob':{
        'required':true,
        'dateISO':true
      },
      'address':{
        'required':true,
        'minlength':10
      },
      'country':{
        'required':true
      },
      'lang[]':{
        'required':true,
        'minlength':2
      },
      'avatar':{
        'required':true,
        'accept':'jpg|jpeg|png|ini'
      },
      'agree':{
        'required':true
      },
    },

  messages: {
    'uname':{
      required: "Name is required.",
      minlength: $.format("Name should be {0} char long."),

    },
    'email':{
      'required':'Email should not be blank',
      'email':'Please enter valid email Id',
      'remote':'Email already taken'

    },
    'password':{
      'required':'Password should not be blank',
      'minlength':$.format("Passowrd should be {0} char long.")
    },
    'c_password':{
      'required':'Re-Password should not be blank',
      'equalTo':'Password not matched'
    },
    'dob':{
        'required':'Date of Birth is required',
        'dateISO':'Please enter DOB in YYYY-MM-DD format'
    },
    'avatar':{
      'required':'Please upload Avatar',
      'accept':$.format("Please upload file with {0} extn.")
    },
  }

  });

});
